//
//  Cover.swift
//  微博项目
//
//  Created by admin on 16/3/3.
//  Copyright © 2016年 jin. All rights reserved.
//

import UIKit

class Cover: UIView {

    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */
    var coverDelegate:CoverDelegate?
    class func show()->Cover
    {
        let cover = Cover(frame: UIScreen.mainScreen().bounds)
        cover.backgroundColor = UIColor.grayColor()
        cover.alpha = 0.5
        UIApplication.sharedApplication().keyWindow?.addSubview(cover)
        return cover
        // UIApplication.sharedApplication().keyWindow?.bringSubviewToFront(self)
    }
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        self.removeFromSuperview()
        self.coverDelegate?.coverClick?()
    }
}
@objc protocol CoverDelegate
{
    optional func coverClick()
}